package demo3;

public class Test {
    public static void useDevice(IUSBable usb) {
        usb.opeanDevice();

        if(usb instanceof Mouse) {
            Mouse mouse = (Mouse) usb;
            mouse.click();
        } else if(usb instanceof Keybord) {
            Keybord keybord = (Keybord)usb;
            keybord.input();
        }

        usb.closeDevice();
    }

    public static void main(String[] args) {

        Computer computer = new Computer();
        computer.opeanDevice();

        useDevice(new Mouse());
        useDevice(new Keybord());


        computer.closeDevice();

    }

}
